package com.zhang.publicproject.module.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zhang.publicproject.common.base.BaseFragment;
import com.zhang.publicproject.module.activity.MainActivity;
import com.zhang.publicproject.module.fragment.FiveFragment;
import com.zhang.publicproject.module.fragment.FourFragment;
import com.zhang.publicproject.module.fragment.OneFragment;
import com.zhang.publicproject.module.fragment.ThreeFragment;
import com.zhang.publicproject.module.fragment.TwoFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/9/6.
 */

public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
    public final int COUNT = 5;
    private String[] titles = new String[]{"Tab1adadadadad", "Tab2", "Tab3adadaddasdadad", "Tab4", "Tab5"};
    private Context context;
    List<BaseFragment> mBaseFragmentList;

    public MyFragmentPagerAdapter(FragmentManager fm, MainActivity context) {
        super(fm);
        this.context = context;
        mBaseFragmentList = new ArrayList<>();
        mBaseFragmentList.add(new OneFragment());
        mBaseFragmentList.add(new TwoFragment());
        mBaseFragmentList.add(new ThreeFragment());
        mBaseFragmentList.add(new FourFragment());
        mBaseFragmentList.add(new FiveFragment());
    }

    @Override
    public Fragment getItem(int position) {
        return mBaseFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return COUNT;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

}
